<div class="main_body">
    <?php echo $this->element('main_menu')?>		
	<div id="main_body_content">
	
	
		<div class="orders index">
			<h1><?php __("Orders");?></h1>
			<table cellpadding="3" cellspacing="0">
			<tr>
					<th><?php echo __("Order info",true)?></th>
					<th><?php echo __("Customer Address",true)?></th>
					<th><?php echo __("Terms",true)?></th>
					<th class="actions"><?php echo __("Employees",true)?></th>
			</tr>
			<?php
		
			$i = 0;
			foreach ($orders as $orders_id => $order):
				$class = null;
				if ($i++ % 2 == 0) {
					$class = ' class="altrow"';
				}
			?>
			<tr<?php echo $class;?>>
				<td width="30%" valign="top" align="left">
					<?php echo $order['Order']['numer']?><br/>
					<?php echo $order['TypesOfSpaces']['name']?> <?php echo $order['TypeOfService']['name']?><br/>
					<?php echo $order['Order']['estimated_execution_time']?> <?php echo __("hours",	true)?><br/>
					<?php echo $order['Order']['value_of_the_order']?> <?php echo __("USD",	true)?><br/>
					<?php echo $typeOfCycles[$order['OrdersCycle']['type_of_cycle_id']]?> x <?php echo $order['OrdersCycle']['repeat']?>
				</td>	
				<td width="30%" valign="top" align="left">
					<?php echo $order['Customer']['name'].' '.$order['Customer']['surname']?><br/>
					<?php echo $order['Customer']['address1'].' '.$order['Customer']['address2']?><br/>
					<?php echo $order['Customer']['address3'].' '.$order['Customer']['address4']?><br/>
					<?php echo __("Phone",true)." ".$order['Customer']['phone1']?>				
				</td>	
				<td width="15%" valign="top" align="left">
					<?php 
						foreach ($order['Terms'] as $date => $date_value):
					?>
					<?php echo $time->format("m-d-Y",$date)?><br/>
					<?php endforeach; ?>
				</td>	
				<td class="actions" width="25%" valign="top">
					<?php 
						$rozdziel_orders = (count($order['Employees']) == 1)?"":'class="rozdziel_orderse"';
						$class____ = "";
					?>					
					<table cellpadding="5" cellspacing="5" class="czysta">
						<?php
						$k = 0;
						foreach ($order['Employees'] as $employee_id => $employee):
							$class___ = null;
							if ($k++ % 2 == 0) {
								$class___ = ' class="altrow_orders"';
							}
							if($k >= 2){
								$class____ = $rozdziel_orders;
							}										
						?>
						<tr<?php echo $class___;?>>
							<td width="50%" <?php echo $class____?>>
								<?php echo $employee['name']?> <?php echo $employee['surname']?>
							</td>
						</tr>
						<?php endforeach; ?>
					</table>
				</td>
			</tr>
		<?php endforeach; ?>
			</table>
		</div>



		<div class="clr"></div>	
	</div>		
	<?php echo $this->element('languages')?>	
	<div class="clr"></div>
	<br/>
</div>	
<div class="clr"></div>	
<div class="main_action">
	<div class="main_action_content">
	
		<div class="actions">
			<h3><?php __("Actions"); ?></h3>
			<ul>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_print_index.png'), array('controller' => 'reports', 'action' => 'index'),array('escape'=>false,'title'=>__("New Report", true))); ?> <div class="clr"></div> <?php echo __("New Report", true)?></li>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_print_pdf.png'), array('controller' => 'reports', 'action' => 'printPdf'),array('escape'=>false,'title'=>__("Print Report", true))); ?> <div class="clr"></div> <?php echo __("Print Report", true)?></li>
			</ul>
		</div>
		
		<div class="clr"></div>
	</div>		
</div>		
